package com.twu.biblioteca;

public class Library {
    Record record = new Record();

    public Item checkOut(Integer itemID, User costumer) {
        Item item = record.getItemByID(itemID);
        if (item == null || ! item.isAvailable()) {
            return null;
        } else {
           item.checkOutBy(costumer);
           return item;
        }
    }

    public Item checkIn(Integer itemID) {
        Item item = record.getItemByID(itemID);
        if (item == null || item.isAvailable()) {
            return null;
        } else {
            item.checkIn();
            return item;
        }
    }
}
